package com.fumin.common;

import com.fumin.pojo.CoinCount;
import com.fumin.pojo.User;
import sun.misc.UUDecoder;

import java.util.LinkedList;
import java.util.List;
import java.util.UUID;


/**
 * Created by Lingo on 2018/2/13.
 */
public  abstract  class AbstractCalculator {

    public List<CoinCount>  makeResult(List<User> fathers){
        List<CoinCount> results = new LinkedList<>();
        Long self=null;
        for (int i = 0; i <fathers.size() ; i++) {
            User user = fathers.get(i);
            CoinCount temp = new CoinCount();
            temp.setPk(UUID.randomUUID().toString());
            temp.setLevel(i);
            temp.setUser_pk(user.getPk());
            if (i==0){
                self=user.getPk();
            }
            temp.setFactor(self);
            results.add(temp);
        }
        return results;
    }

}
